package tianrun.ziguan.api.calculate.config.dto.excel;


import com.alibaba.excel.annotation.ExcelProperty;
import tianrun.ziguan.api.calculate.config.config.excel.TimeConverter;
import tianrun.ziguan.api.calculate.config.service.influxdb.impl.InsertValue;

import java.math.BigDecimal;

public class TimeValueImport {
    @ExcelProperty(value = "时间",converter = TimeConverter.class)
    private Long time;
    @ExcelProperty(value = "数值")
    private BigDecimal value;

    public Long getTime() {
        return time;
    }

    public void setTime(Long time) {
        this.time = time;
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }


    public InsertValue of(String label, String assetNum){
        InsertValue insertValue = new InsertValue();
        insertValue.setValue(value.doubleValue());
        insertValue.setLabel(label);
        insertValue.setTableName(assetNum);
        insertValue.setTime(time);
        return insertValue;
    }
}
